package com.giao.controller;

import com.giao.entity.Book;
import com.giao.mapper.BookDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CacheConfig
public class BookController {
    @Autowired
    BookDao bookDao;
    @RequestMapping("/findallbook")
    @Cacheable(value = "book")
    public void findallbook(){
        List<Book> books = bookDao.findAll();

        for (Book book : books) {
            System.out.println(book);
        }
    }
}
